const hre = require("hardhat");

async function main() {
  const contractAddress = "0x5C32Fd79c758E200F8E7E71d5d37469daB239811";
  const tokenAddress = "0xb5fC92D6abfAD8011A482ef571ABA68FcF6bd3dA";
  
  // 获取ERC20 token合约
  const ERC20_ABI = [
    "function balanceOf(address owner) view returns (uint256)",
    "function totalSupply() view returns (uint256)",
    "function allowance(address owner, address spender) view returns (uint256)",
    "function decimals() view returns (uint8)"
  ];
  
  const tokenContract = new hre.ethers.Contract(tokenAddress, ERC20_ABI, hre.ethers.provider);
  
  console.log("Token address:", tokenAddress);
  console.log("Launch contract address:", contractAddress);
  
  try {
    // 检查launch contract在token合约中的余额
    const balance = await tokenContract.balanceOf(contractAddress);
    console.log("Launch contract token balance:", hre.ethers.formatEther(balance));
    
    // 检查总供应量
    const totalSupply = await tokenContract.totalSupply();
    console.log("Token total supply:", hre.ethers.formatEther(totalSupply));
    
    // 检查decimals
    const decimals = await tokenContract.decimals();
    console.log("Token decimals:", decimals);
    
  } catch (error) {
    console.error("Error checking token:", error.message);
  }
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });
